local P = {}


function P:LoadConfig(configName)
	local dir = rawget(self, "dir")

	if dir then
		ret = dofile(dir.."/"..configName..".lua")
		if type(ret) ~= "table" then
			logError("load "..configName.." config error: "..ret)
		else
			return ret
		end
	end
end

local LoadConfig = P.LoadConfig

function P.__index(t, k)
	local a = rawget(t, k)
	if a then
		return a
	end

	local v = LoadConfig(t, k)
	rawset(t, k, v)
	return v
end






function P.New(dir)
	local a = New(P)
	rawset(a, "dir", dir)
	return a
end



P = ClassFromFile(..., P);
